package com.itboye.jigongbao.db;

import com.itboye.jigongbao.app.MyApplication;

/**
 * Created by Administrator on 2017/12/20.
 */

public class DBParams {
    //数据库名字
    public static String DB_NAME = MyApplication.Companion.getInstance().getPackageName() + "CacheDB.addressDb";
    //数据库版本
    public static int DB_VERSION = 1;
    //数据库存储路径
    public static String DB_PATH = MyApplication.Companion.getInstance().getCacheDir() + "/" + MyApplication.Companion.getInstance().getPackageName();
    //数据库缓存表名称
    public static String TABLE_NAME = "_cache_info";

    /**
     * 表结构
     * id      自增id
     * uid     用户UID
     * typeKey api请求接口类型
     * lastTime请求时间
     * data 得到的数据
     * api_ver 接口版本号
     * update_time 插入数据库时间
     */
    public static String COLUMN_ID = "id";

    public static String COLUMN_UID = "uid";

    public static String COLUMN_TYPE_KEY = "typeKey";

    public static String COLUMN_LAST_TIME = "lastTime";

    public static String COLUMN_DATA = "data";

    public static String COLUMN_API_VER = "api_ver";

    public static String COLUMN_INSERT_TIME = "insert_time";

    public static String COLUMN_PAGE_INDEX = "page_index";

    //建表sql
    public static String CREATE_TABLE_SQL = "CREATE TABLE IF NOT EXISTS " + TABLE_NAME + " (" + COLUMN_ID + " INTEGER PRIMARY KEY AUTOINCREMENT," +
            COLUMN_UID + " TEXT," +
            COLUMN_TYPE_KEY + " TEXT," +
            COLUMN_LAST_TIME + " TEXT," +
            COLUMN_DATA + " TEXT," +
            COLUMN_API_VER + " TEXT," +
            COLUMN_INSERT_TIME + " TEXT," +
            COLUMN_PAGE_INDEX + " TEXT"+
            ")";

}
